package mop.model.user;

import mop.exception.IllegalDescriptionException;
import mop.exception.IllegalDuplicationException;
import mop.exception.IllegalIdException;
import mop.model.AbstractModelWithDescription;
import mop.model.DataBase;
import mop.security.acl.RoleInterface;

/**
 * UserType class
 * @author MOP Team 7
 * 
 */
public class UserType extends AbstractModelWithDescription implements UserTypeInterface, RoleInterface
{

	/**
	 * Constructor for UserType
	 * 
	 * @param db 			The database voor UserTypes
	 * @param id			The identifier of the usertype
	 * @param description 	The description of the usertype
	 * 
	 * @effect	(Tries to) set the description.
	 * 			| setDescription(description)
	 * 
	 * @effect Gets added to the database db
	 * 
	 * @throws  IllegalDescriptionException
	 * 			Thrown when the Project description is invalid.
	 * 
	 * @throws IllegalDuplicationException 
	 * 			Usertype must be unique
	 * 
	 * @throws IllegalIdException 
	 * 			Thrown when the Project identifier is invalid
	 */
	public UserType(DataBase<UserType> db,String id,String description) throws IllegalDescriptionException,IllegalDuplicationException, IllegalIdException
	{
		super(id,description);
		db.add(this);
	}
	
	/***************************************************************************
	 * 						Model interface
	 ***************************************************************************/
	
	/**
	 * get a reference to the interface
	 * @return this
	 */
	public UserTypeInterface getInterface()
	{
		return this;
	}
	
	/**
	 * @see RoleInterface#getRoleId()
	 */
	public String getRoleId(){
		return getId();
	}

}
